#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QSignalMapper>

#include "cqtuart.h"
#include "cbasemodule.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT
    
public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    void sendMsg( unsigned short i_dest_addr, unsigned char i_fam_id, unsigned char i_cmd_id,
                    unsigned char i_len, unsigned char *ip_payload );

public slots:
    void received_msg( void );
    void map_btn_clicked( int id );

private slots:
    void on_BtnComPort_clicked();

    void on_BtnGetId_clicked();

    void on_BtnClearWindows_clicked();

private:
    Ui::MainWindow *ui;
    CQtUart uart;
    QSignalMapper *btn_mapper;
    QList <CBaseModule *> modules;

    CBaseModule *GetModules( int i_id );
    void dispatch_msg( int i_id, QList<unsigned char> *ip_msg );
};

#endif // MAINWINDOW_H
